//
//  secondViewController+dateHandle.m
//  mac2
//
//  Created by 李劭华 on 2021/7/27.
//

#import "secondViewController+dateHandle.h"

@implementation secondViewController (dateHandle)
-(NSString *)getStringFromDate:(NSDate *)date
{
    if (!date) {
        return @"";
    }
    //获取系统当前时间
    NSDate *currentDate = [NSDate date];
    //用于格式化NSDate对象
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    //设置格式：zzz表示时区
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
    //NSDate转NSString
    NSString *currentDateString = [dateFormatter stringFromDate:date];;
    //输出currentDateString
    NSLog(@"%@",currentDateString);
    return currentDateString;
}
@end
